home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / comm / cnet / MainMacros.lha / MainMacroEdit.rexx next >
OS/2 REXX Batch file  |  1995-04-18  |  2KB  |  59 lines

  1. /* $VER: MainMacroEdit.rexx 1.0 (4/18/95 by Spike Dethman)
  2. */
  3. /* edit the macros and prompts files for MainMacros */
  4. options results ; signal on SYNTAX ; signal on ERROR ; signal on IOERR
  5. changewhere 'MainMacroEdit'
  6.  
  7. path="env:MainMacros/"
  8. path2="envarc:MainMacros/"
  9. macro="MainMacros"
  10. prompt="MainPrompts"
  11.  
  12. Start:
  13. transmit 'n2** Main Macro Editor by Spike Dethman **'
  14. transmit '===========================================n1'
  15. transmit 'Edits go into effect immediately.  Save to ENVARC: to make changes permanant.'
  16. transmit '(Still active after a reboot.)n2'
  17. file=path||prompt ; file2=path2||prompt
  18. transmit 'cfDo you wish to edit the Main prompt list [No]? ?0}' ; getuser 70
  19. if result=1 then call EditFile
  20.  
  21. file=path||macro ; file2=path2||macro
  22. transmit 'cfDo you wish to edit the Macros list [No]? ?0}' ; getuser 70
  23. if result=1 then call EditFile
  24.  
  25. bufferflush ; exit
  26.  
  27. EditFile:
  28. changewhat 'Editing...'
  29. loadeditor (file) ; calleditor (0)
  30. changewhat 'Saving...' ; saveeditor (file)
  31. sendstring 'Counting entries...'
  32. call open(f1,file,'r') ; num=0 ;
  33. do while ~eof(f1) ;
  34.     i=readln(f1) ;
  35.     num=num+1 ;
  36.     sendstring '.' ;
  37. end ; num=num-1 ; call close(f1)
  38. call open(f1,file'Num','w') ;
  39. call writeln(f1,num) ;
  40. call close(f1)
  41. transmit 'n1'num' entries written.'
  42.  
  43. transmit 'cfn1Save to ENVARC: to survive a reboot [No]? ?0}' ; getuser 70
  44. if result=1 then do ;
  45.     address command 'copy "'file'" to "'file2'"' ;
  46.     address command 'copy "'file'Num" to "'file2'Num"' ;
  47.     transmit 'Saved to ENVARC:' ;
  48. end
  49.  
  50. return
  51.  
  52.  
  53. SYNTAX:
  54. ERROR:
  55. IOERR:
  56. transmit errortext(RC)" error in l "sigl"n1>>"sourceline(sigl)"<<"
  57. bufferflush
  58. exit 10
  59.